package com.nulstudio.sppm.mapper;

import com.nulstudio.sppm.domain.vo.InventoryVo;
import com.nulstudio.sppm.entity.NulInventory;
import org.apache.ibatis.annotations.Param;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface InventoryMapper {
    @NonNull
    List<InventoryVo> fetchInventory(@Param("warehouseId") int warehouseId, @Param("name") @NonNull String name);

    boolean checkExistence(@Param("warehouseId") int warehouseId, @Param("commodityId") int commodityId, @Param("supplierId") int supplierId);

    int insert(@Param("inventory") @NonNull NulInventory inventory);

    int update(@Param("inventory") @NonNull NulInventory inventory);

    int delete(@Param("warehouseId") int warehouseId, @Param("id") @NonNull List<Integer> id);

    @Nullable
    NulInventory findInventoryById(@Param("id") int id);

    @Nullable
    NulInventory findInventory(@Param("warehouseId") int warehouseId, @Param("commodityId") int commodityId, @Param("supplierId") int supplierId);
}
